<?php

use \app\modules\setting\models\RolesLut;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\widgets\Breadcrumbs;

/* @var $this yii\web\View */
/* @var $model app\models\Check */

$this->title = '权限分配';
$this->params['breadcrumbs'][] = ['label' => '设置', 'url' => ['/setting/user/index']];
$this->params['breadcrumbs'][] = ['label' => '管理员信息', 'url' => ['/setting/user/index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<?= Breadcrumbs::widget([
    'homeLink' => ['label' => '医疗管理系统', 'url' => '#'],
    'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>

<div class="check-update">

    <div class="check-form myForm">

        <div class="alert alert-danger" id="error-msg"></div>

        <?php $form = ActiveForm::begin([
            'method' => 'post',
            'action' => '/setting/user/assign-permissions?id='.$model->user_id,
        ]); ?>

        <h3>正在为用户 <strong style="color: #3b7eba"><?= $username ?></strong> 分配角色</h3>

        <?= $form->field($model, 'role_id')->checkboxList(RolesLut::getRolesAsList()) ?><br />

        <div class="form-group">
            <?= Html::submitButton('保存', ['class' => 'btn btn-primary', 'id' => 'submitButton']) ?>

            <?= Html::a('取消', ['/setting/user'], ['class' => 'btn btn-success']) ?>
        </div>

        <?php ActiveForm::end(); ?>

    </div>

</div>
